package com.sqx.modules.order.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.order.entity.OrderGoods;
import com.sqx.modules.order.entity.TbOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface AppOrderDao extends BaseMapper<TbOrder> {

   // IPage<TbOrder> selectOrderList(Page<TbOrder> pages, @Param("userId") Long userId,@Param("status") Integer status,@Param("orderType") Integer orderType, @Param("shopId")Long shopIs);

    IPage<TbOrder> selectOrderList(Page<TbOrder> pages, @Param("userId") Long userId, @Param("status") Integer status, @Param("orderType") Integer orderType, @Param("shopId")Long shopIs);

    int insertOrder(TbOrder order);

    IPage<TbOrder> selectOrder(Page<TbOrder> pages,@Param("status") Integer status,@Param("phone") String phone, @Param("shopId") Long shopId,
                               @Param("userName") String userName, @Param("orderNumber") String orderNumber,@Param("orderType") Integer orderType,@Param("shopName")String shopName);


    IPage<TbOrder> selectAllOrderAdmin(Page<TbOrder> pages,@Param("status") Integer status,@Param("phone") String phone, @Param("shopId") Long shopId,
                               @Param("userName") String userName, @Param("orderNumber") String orderNumber,@Param("orderType") Integer orderType,@Param("shopName")String shopName,@Param("riderPhone") String riderPhone);


    IPage<TbOrder> selectOrderByAdmin(Page<TbOrder> pages,@Param("status") Integer status,@Param("phone") String phone,
                                      @Param("shopId") Long shopId, @Param("userName") String userName,
                                      @Param("userId") Long userId,@Param("orderNumber") String orderNumber,@Param("orderType") Integer orderType);

    int selectCountOrderByUserId(Long userId, String date, String dateType);

    BigDecimal selectSunMoneyByUserId(Long userId, String date, String dateType);

    IPage<TbOrder> selectOrderDetails(Page<TbOrder> pages, Long userId);

    IPage<TbOrder> waitTakeFood(Page<TbOrder> pages, Long userId, Integer orderType, Integer status);

    int selectCountOrderByTime(@Param("payTime") String payTime, @Param("shopId") Long shopId);

    int deleteCouponByOrderId(@Param("orderId") Long orderId);

    BigDecimal selectSumMoney(@Param("date") String date,@Param("dateType") String dateType,@Param("shopId") Long shopId);

    int selectCountOrder(@Param("date") String date,@Param("dateType") String dateType,@Param("shopId") Long shopId);

    int updateorderStatus(String date);

    List<TbOrder> selectOrderByTimeList(String date);

    List<TbOrder> selectShoppingTrolley(Long userId);

    TbOrder selectShoppingTrolleyByShopId(Long userId, Long shopId);

    TbOrder selectByOrderId(Long orderId);

    TbOrder selectBuyGoods(Long orderId, Long userId);

    List<TbOrder> selectOverTimeOrder(String overTime);

}
